package com.airnewslinkosky.ticket.net.type;

import java.util.List;

import com.airnewslinkosky.ticket.model.MileagerInfo;

public class RequestMileagerInfo {
	/** AS编码 */
	public String asID;
	/** 用户优先级别 */
	public String asPriority;
	/** 时间戳，当前接口调用时间 */
	public String timeStamp;
	/** 登录密码 */
	public String userSign;
	/** 授权码 */
	public String officeSign;
	/** 操作类型 */
	public String operateType;
	/** asToken */
	public String asToken;
	
	public String getRequestData(List<MileagerInfo> mileagerInfoList) {
		StringBuffer sb = new StringBuffer();
		sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>")
		  .append("<soap:Envelope xmlns:soap='http://www.w3.org/2003/05/soap-envelope' xmlns:coa='http://COA.airnew.com'>")
		  .append("<soap:Header/>")
		  .append("<soap:Body>")
		  .append("<coa:MileagerInfoManage>")
		  .append("<coa:ASID>").append(this.asID).append("</coa:ASID>")
		  .append("<coa:TimeStamp>").append(this.timeStamp).append("</coa:TimeStamp>")
		  .append("<coa:OfficeSign>").append(this.officeSign).append("</coa:OfficeSign>")
		  .append("<coa:UserSign>").append(this.userSign).append("</coa:UserSign>")
		  .append("<coa:ASToken>").append(this.asToken).append("</coa:ASToken>")
		  .append("<coa:OperateType>").append(this.operateType).append("</coa:OperateType>")
		  .append("<coa:MileageInfos>");
		  for(MileagerInfo mInfo:mileagerInfoList){
			  sb.append("<coa:MileagerInfo>")
			    .append("<coa:MileagerNO/>")
			    .append("<coa:PassengerNO>").append(mInfo.getPassengerNO()).append("</coa:PassengerNO>")
			    .append("<coa:MileagerCardAirline>").append(mInfo.getMileagerCardAirline()).append("</coa:MileagerCardAirline>")
			    .append("<coa:MileagerCardNumber>").append(mInfo.getMileagerCardNumber()).append("</coa:MileagerCardNumber>")
			    .append("<coa:Remark/>")
			    .append("</coa:MileagerInfo>");
		  }
		  sb.append("</coa:MileageInfos>")
		    .append("</coa:MileagerInfoManage>")
		    .append("</soap:Body>")
		    .append("</soap:Envelope>");
		return sb.toString();
	}
}
